package com.kimwu.design.mediator.monarch.impl;

import com.kimwu.design.mediator.monarch.Monarch;
import com.kimwu.design.mediator.official.impl.HeEr;
import com.kimwu.design.mediator.official.impl.LaoJi;

/**
 * 黄三（皇上）
 */
public class HuangSan extends Monarch {
    /**
     * 处理各个官员之间的互相参奏的折子
     *
     * @param name
     * @param method
     */
    @Override
    public void execute(String name, String method) {
        //做好自己份内的事情
        if ("self".equals(method)) {
            if ("laoji".equals(name)) {
                ((LaoJi) super.officials.get(name)).self();
            } else {
                ((HeEr) super.officials.get(name)).self();
            }
            //我要参别人一本
        } else {
            if ("laoji".equals(name)) {
                ((LaoJi) super.officials.get(name)).out();
            } else {
                ((LaoJi) super.officials.get(name)).out();
            }
        }
    }

}